<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>更新</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="${siteurl}bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="${siteurl}plugins/FontAwesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="${siteurl}plugins/ionicons201/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="${siteurl}dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="${siteurl}dist/css/skins/_all-skins.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    [#include "/admin/common/commons.html"]

    <!-- jQuery 2.2.3 -->
    <script src="${siteurl}plugins/jQuery/jquery-2.2.3.min.js"></script>
    <!-- Bootstrap 3.3.6 -->
    <script src="${siteurl}bootstrap/js/bootstrap.min.js"></script>
    <!-- SlimScroll -->
    <script src="${siteurl}plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="${siteurl}plugins/fastclick/fastclick.js"></script>
    <!-- AdminLTE App -->
    <script src="${siteurl}dist/js/adminlte.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <link rel="stylesheet" href="${siteurl}plugins/bootstrap-datepicker/css/bootstrap-datepicker3.css">
    <script src="${siteurl}plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script src="${siteurl}plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=PYWBZ-QHE3I-L7WGT-5THCC-KOPH7-Y6FSC"></script>
    <style type="text/css">
        .form-group label{
            padding-right: 0px;
            padding-left: 0px;
        }
        .positioning{
            z-index: 100;
            position: absolute;
            top:5px;
            right: 30px;
            width:15px;
            height:20px;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini"  onload="init()" >
<!-- Site wrapper -->
<div class="wrapper">

    <header class="main-header">
        <!-- Header Navbar: style can be found in header.less -->
        [#include "/admin/common/nav.html"]
    </header>

    <!-- =============================================== -->

    <!-- Left side column. contains the sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <!-- Sidebar user panel -->
            [@user_panel /]
            <!-- search form -->
            [@sidebar_form /]
            <!-- /.search form -->
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu" data-widget="tree">
                <li class="header">主面板</li>
                [@menustag id=1]
                [#list list as item]
                [@menu item "1,54,56"]
                [/@menu]
                [/#list]
                [/@menustag]
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- =============================================== -->

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <!-- Main content -->
        <section class="content">

            <!-- Default box -->
            <div class="">
                <div class="box box-default box-solid">
                    <div class="box-header with-border">
                        <h3 class="box-title">更新</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form class="form-horizontal" action="${siteurl}admin/tenant/model_update.htm" method="post">
                        <input type="hidden" name="id" value="${model.id}">
                        <input type="hidden" name="pageNumber" value="${(page.pageNumber)!'1'}">
                        <input type="hidden" id="lng" name="lng" value="${(model.lng)!''}">
                        <input type="hidden" id="lat" name="lat" value="${(model.lat)!''}">
                        <div class="box-body">
                            <div class="form-group ">
                                <label for="name" class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input value="${model.name!''}" class="form-control" id="name" name="name"
                                           placeholder="名称" type="text">
                                </div>
                            </div>
                            <div class="form-group ">
                                <label for="beginDate" class="col-sm-2 control-label">开始日期</label>
                                <div class="col-sm-10">
                                    <input value="${model.beginDate!''}" class="form-control" id="beginDate"
                                           name="beginDate" placeholder="开始日期" type="text">
                                </div>
                            </div>
                            <div class="form-group ">
                                <label for="expireDate" class="col-sm-2 control-label">到期日期</label>
                                <div class="col-sm-10">
                                    <input value="${model.expireDate!''}" class="form-control" id="expireDate"
                                           name="expireDate" placeholder="到期日期" type="text">
                                </div>
                            </div>
                            <div class="form-group ">
                                <label for="theme" class="col-sm-2 control-label">样式主题</label>
                                <div class="col-sm-10">
                                    <input value="${model.theme!''}" class="form-control" id="theme" name="theme"
                                           placeholder="样式主题" type="text">
                                </div>
                            </div>

                            <div class="form-group ">
                                <label for="phone" class="col-sm-2 control-label">电话</label>
                                <div class="col-sm-10">
                                    <input value="${model.phone!''}" class="form-control" id="phone" name="phone"
                                           placeholder="电话" type="text">
                                </div>
                            </div>
                            <div class="form-group ">
                                <label for="address" class="col-sm-2 control-label">地址</label>
                                <div class="col-sm-10">
                                    <input value="${model.address!''}" class="form-control" id="address" name="address"
                                           placeholder="地址" type="text">
                                    <img id="poi" class="positioning" src="${siteurl}dist/img/positioning.png" alt="">

                                </div>
                            </div>
                            <div class="form-group ">
                                <label for="map" class="col-sm-2 control-label">地图</label>
                                <div class="col-sm-10" >
                                    <div id="map" style="height: 200px;"></div>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary pull-right">更新</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
            <!-- /.box -->

        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    [#include "/admin/common/footer.html"]

    <!-- Control Sidebar -->
    [#include "/admin/common/aside.html"]

    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<script type="text/javascript">
    $(document).ready(function () {

        $('#beginDate').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: true,
            clearBtn: true,
            language: "zh-CN",
            calendarWeeks: true,
            autoclose: true
        });
        $('#expireDate').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: true,
            clearBtn: true,
            language: "zh-CN",
            calendarWeeks: true,
            autoclose: true
        });
    });
</script>
<script type="text/javascript">
    var citylocation,map,marker = null;
    var init = function() {
        var center = new qq.maps.LatLng(${(model.lat)!'34.33422273578077'},${(model.lng)!'108.9480471611023'});
        map = new qq.maps.Map(document.getElementById('map'),{
            center: center,
            zoom: 20
        });
        //获取城市列表接口设置中心点
        citylocation = new qq.maps.CityService({
            complete : function(result){
                map.setCenter(result.detail.latLng);
            }
        });
        //调用searchLocalCity();方法    根据用户IP查询城市信息。
        //citylocation.searchLocalCity();

        qq.maps.event.addListener(
            map,
            'click',
            function(event) {
                $("#lat").val(event.latLng.getLat())
                $("#lng").val(event.latLng.getLng())
                if(marker!=null){
                    marker.setMap(null);
                }
                center= new qq.maps.LatLng(event.latLng.getLat(),event.latLng.getLng());
                marker = new qq.maps.Marker({
                    position: center,
                    map: map
                });

            }
        );
        //创建标记
        marker = new qq.maps.Marker({
            position: center,
            map: map
        });
    }

    function geolocation_ip() {
        var clientip = document.getElementById("client_ip").value;
        var city = document.getElementById("city");
        //调用查询ip接口查询信息
        citylocation.searchCityByIP(clientip);
    }

    $(document).ready(function () {
        $("#poi").click(function () {
            var params={};
            params.address=$("#address").val();
            $.post("${siteurl}rest/lbs/search.htm",params,function (back) {
                if (back.code==0){
                    console.log(back);
                    $("#lat").val(back.lat)
                    $("#lng").val(back.lng)
                    if(marker!=null){
                        marker.setMap(null);
                    }
                    center= new qq.maps.LatLng(back.lat,back.lng);
                    marker = new qq.maps.Marker({
                        position: center,
                        map: map
                    });
                    map.setCenter(center);

                }
            });
        });
    });
</script>
</body>
</html>
